# -*- coding: utf-8 -*-
import scrapy


class ReqDocSpider(scrapy.Spider):
    name = 'req_doc'
    allowed_domains = ['blog.csdn.net']
    start_urls = ['https://blog.csdn.net/qq_32252917/article/details/78170153']

    def parse(self, response):
        req_list = response.xpath("/html/body/div[@id='mainBox']/main/div[@class='blog-content-box']/article/div["
                                  "@id='article_content']/div[@class='htmledit_views']/div/span")
        for i_item in req_list:
            req_item = i_item.xpath("./text()").extract_first()
            if req_item is None:
                req_item = i_item.xpath("./em/text()").extract_first()
                if req_item is None:
                    req_item = i_item.xpath("./strong/text()").extract_first()

            print(req_item)
